/*
 * @Author: LiZhiJian
 * @Description: 
 * @Date: 2025-10-25 11:10:01
 * @LastEditTime: 2025-10-26 14:21:59
 * @Email: LiZhiJian8552@163.com
 */
#ifndef __OLED_H
#define __OLED_H
#include "stm32f10x.h"
#include <stdint.h>
#include "OLED_Data.h"

/*******************参数宏定义****************************/
// 用于判断，也用于计算横向字符偏移，默认值为字体像素宽度
#define OLED_8X16 8
#define OLED_6X8 6

// 判断是否填满
#define OLED_UNFILLED 0
#define OLED_FILLED 1
/*******************************************************/


// 初始化OLED
void OLED_Init(void);

// 更新
void OLED_Update(void);
void OLED_UpdateArea(uint8_t X,uint8_t Y,uint8_t Width,uint8_t Height);

// 清空
void OLED_Clear(void);
void OLED_ClearArea(uint8_t X,uint8_t Y,uint8_t Width,uint8_t Height);

// 反转
void OLED_Reverse(void);
void OLED_ReverseArea(uint8_t X,uint8_t Y,uint8_t Width,uint8_t Height);


// 显示
void OLED_ShowChar(uint8_t X,uint8_t Y,char ch,uint8_t FontSize);
void OLED_ShowString(uint8_t X,uint8_t Y,char* str,uint8_t FontSize);
void OLED_ShowNum(uint8_t X, uint8_t Y, uint32_t Number, uint8_t Length, uint8_t FontSize);
void OLED_ShowSignedNum(uint8_t X, uint8_t Y, int32_t Number, uint8_t Length, uint8_t FontSize);
void OLED_ShowHexNum(uint8_t X, uint8_t Y, uint32_t Number, uint8_t Length, uint8_t FontSize);
void OLED_ShowBinNum(uint8_t X, uint8_t Y, uint32_t Number, uint8_t Length, uint8_t FontSize);
void OLED_ShowFloatNum(uint8_t X, uint8_t Y, double Number, uint8_t IntLength, uint8_t FraLength, uint8_t FontSize);
void OLED_ShowChinese(uint8_t X, uint8_t Y, char *Chinese);
void OLED_ShowImage(uint8_t X, uint8_t Y, uint8_t Width, uint8_t Height, const uint8_t *Image);
void OLED_Printf(uint8_t X, uint8_t Y, uint8_t FontSize, char *format, ...);


// 绘图
void OLED_DrawPoint(uint8_t X, uint8_t Y);
void OLED_DrawLine(uint8_t X0, uint8_t Y0, uint8_t X1, uint8_t Y1);
void OLED_DrawRectangle(uint8_t X, uint8_t Y, uint8_t Width, uint8_t Height, uint8_t IsFilled);
void OLED_DrawTriangle(uint8_t X0, uint8_t Y0, uint8_t X1, uint8_t Y1, uint8_t X2, uint8_t Y2, uint8_t IsFilled);
void OLED_DrawCircle(uint8_t X, uint8_t Y, uint8_t Radius, uint8_t IsFilled);
void OLED_DrawEllipse(uint8_t X, uint8_t Y, uint8_t A, uint8_t B, uint8_t IsFilled);
void OLED_DrawArc(uint8_t X, uint8_t Y, uint8_t Radius, int16_t StartAngle, int16_t EndAngle, uint8_t IsFilled);


uint8_t OLED_GetPoint(uint8_t X, uint8_t Y);

void OLED_Test(void);

#endif
